/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.ufpb.halloc.conexaoDB;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author leonardo
 */
public class DataSourceConnection implements DataSourceConnectionIF{
    
    private String url;
    private String usuario;
    private String senha;

    public DataSourceConnection(String url, String driver, String usuario, String senha) {
        this.url = url;
        this.usuario = usuario;
        this.senha = senha;
        try {
            Class.forName(driver);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(DataSourceConnection.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    @Override
    public Connection getConnection() throws SQLException {
        Connection conn = DriverManager.getConnection(url, usuario, senha);
        return conn;
    }
    
 }